import request from '@/api/request'

interface NotificationListParams {
  page?: number
  pageSize?: number
  type?: 'info' | 'warn' | 'error' | 'success'
  unread?: boolean
}

interface NotificationDetailParams {
  id: string
}

/**
 * 查询我的通知列表
 * @param params 查询参数
 * @returns 通知列表
 */
export function getMyNotificationList(params?: NotificationListParams) {
  return request.post('/notifications/my-list', params || {})
}

/**
 * 查询我的通知详情
 * @param data 请求数据
 * @returns 通知详情
 */
export function getMyNotificationDetail(data: NotificationDetailParams) {
  return request.post('/notifications/my-detail', data)
}

/**
 * 标记通知为已读
 * @param data 请求数据
 * @returns 响应结果
 */
export function markNotificationAsRead(data: NotificationDetailParams) {
  return request.post('/notifications/read', data)
}

/**
 * 标记所有通知为已读
 * @returns 响应结果
 */
export function markAllNotificationsAsRead() {
  return request.post('/notifications/read-all', {})
}

